package com.ruoyi.generator;


import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import org.springframework.util.CollectionUtils;

import java.util.*;

public class FastCreator {

    public static void main(String[] args) {
        String password = "shitang@123?";
        String username = "root";
        String url = "jdbc:mysql://1.92.147.76:6613/shitang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
        String outputDir = "F:\\work\\shitangguanlixitong\\backend\\ruoyi-system\\src\\main\\java";

        FastAutoGenerator.create(url, username, password)
                .globalConfig(builder -> builder
                        .author("qubaofeng")
                        .outputDir(outputDir)
                        .disableOpenDir()
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.ruoyi.system")
                        .entity("domain")
                        .mapper("mapper")
                        .service("service")
                        .serviceImpl("service.impl")
                        .xml("mapper")
                )
                .strategyConfig(builder -> builder
                        .addInclude("huo_pin_price_his")
                        .entityBuilder()
                        .enableLombok()
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }

}
